package com.train.service.impl;

import com.train.mapper.UserMapper;
import com.train.pojo.po.User;
import com.train.service.UserService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * @Desc: 用户业务层，做业务逻辑
 * @Author: wjl
 * @DateTime: 2025/05/12 20:19:15
 */

@Service
@RequiredArgsConstructor
public class UserServiceimpl implements UserService {

    private final UserMapper mapper;
    /**
     * @param phone 手机号
     * @param password 密码
     * @Desc: 用户登录
     * @Author: wjl
     * @DateTime: 2025/05/12 20:17:51
     * @Return: @return {@link String }
     */
    @Override
    public String login(String phone, String password) {
        User user=mapper.selectByPhone(phone);
        if(user==null){
            return "notfound";
        }
        if (user.getPassword().equals(password)) {
            return "success";
        }
        return "fail";

    }
}
